package jwlee.testdb;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

public class JDBCTester {
	public static void testjdbc() throws Exception {
		Class.forName("oracle.jdbc.driver.OracleDriver");

		String url;
		url = "jdbc:oracle:thin:@MZJPC:1521:mzjdb";
		//url = "jdbc:oracle:thin:@10.13.0.252:1521:cqkf";
		Connection con = DriverManager.getConnection(url, "db_zgxt", "cssgdlt");

		Statement stmt = con.createStatement();

		String sql;
		sql = "SELECT ID FROM MZJTEST WHERE NAME LIKE \'\\%%\' {ESCAPE \'\\\'}";
		sql = "SELECT * FROM MZJTEST WHERE NAME LIKE {fn UCASE('mzj')}";
		ResultSet rs = stmt.executeQuery(sql);

		while (rs.next()) {
			System.out.println(rs.getString(1));
		}

		stmt.close();
	}

	public static void main(String[] args) throws Exception {
		testjdbc();
	}
}
